<%--
  Created by IntelliJ IDEA.
  User: 123
  Date: 2020/11/6
  Time: 8:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <form id="s">
        姓名:<input name="u.name">
        年龄:<input name="u.age">
        <button onclick="doAjax()" type="button" >提交</button>
    </form>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.1.js"></script>
<script type="text/javascript">
    function doAjax() {
        $.ajax({
            url:"${pageContext.request.contextPath}/mains/mains_insert",
            data:$("#s").serialize(),
            type:"post",
            success:function (date) {
                console.log(date)
                location="${pageContext.request.contextPath}/show.jsp"
            }
        })
    }
</script>
</body>
</html>
